package com._bytecode.__jdk_proxy;

import java.lang.reflect.Proxy;

public class Test {

    public static void main(String[] args) {
        PurchaserImpl purchaser = new PurchaserImpl();
        MyInvocationHandler myInvocationHandler = new MyInvocationHandler(purchaser);
        IPurchaser proxyInstance = (IPurchaser) Proxy.newProxyInstance(IPurchaser.class.getClassLoader(), new Class[]{IPurchaser.class}, myInvocationHandler);
        proxyInstance.buy();
        proxyInstance.buy2();
    }

}
